package com.yjck.fm.common;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.json.annotations.JSON;

import com.opensymphony.xwork2.ActionSupport;

public class BasicAction extends ActionSupport {
	private static final long serialVersionUID = 1L;
	private String loginEmail = (String) ServletActionContext.getRequest()
			.getSession().getAttribute("email");
	private boolean loginFlag = setLoginFlag();
	private int loginId = (Integer) ServletActionContext.getRequest()
			.getSession().getAttribute("id");
	private String loginName = (String) ServletActionContext.getRequest()
			.getSession().getAttribute("name");
	private String loginSex = (String) ServletActionContext.getRequest()
			.getSession().getAttribute("sex");
	protected Map<String, Object> map = new HashMap<String, Object>();
	private int start;
	private int limit;
	
	public void setStart(int start) {
		this.start = start;
	}

	public int getLimit() {
		return limit;
	}

	public String getLoginEmail() {
		return loginEmail;
	}

	public boolean getLoginFlag() {
		return loginFlag;
	}

	public int getLoginId() {
		return loginId;
	}

	public String getLoginName() {
		return loginName;
	}

	public String getLoginSex() {
		return loginSex;
	}

	public int getStart() {
		return start;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public boolean setLoginFlag() {
		boolean flag = false;
		String loginFlag = (String) ServletActionContext.getRequest()
				.getSession().getAttribute("loginflag");
		if (StringUtils.isNotEmpty(loginFlag) && loginFlag.equals("yjck67")) {
			flag = true;
		} else {
			flag = false;
		}
		return flag;
	}
	@JSON
	public Map<String, Object> getMap() {
		return map;
	}

}
